package java_demos.java_basic.instance_demos.about_string;

public class StringCompareEmp {
    public static void main(String[] args) {
        String str = "Hello World";
        String anotherStr = "hello world";
        Object objStr = str;

        System.out.println(str.compareTo(anotherStr));
        System.out.println(str.compareToIgnoreCase(anotherStr));// 忽略大小写
        System.out.println(str.compareTo(objStr.toString()));

        /*
        * compareTo(String)方法比较两个字符串的，并返回字符串中第一个字母Ascll的差值
        *
        * */
    }
}
